package com.headhunter.listener;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

import javax.servlet.ServletContextEvent;

import com.headhunter.server.Headhunter;

public class ServerListener implements javax.servlet.ServletContextListener {
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		//do whatever you want
	}
	
	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		String url = "rmi://localhost:1099/Headhunter";
		try {
			Headhunter headHunter = (Headhunter) Naming.lookup(url);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (RemoteException e) {
			e.printStackTrace();
		} catch (NotBoundException e) {
			e.printStackTrace();
		}
	}
}